<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录 - 橙园社区</title>
    <link rel="stylesheet" href="../css/login.css">
</head>
<body>
    <div class="container">
        <h1>橙园社区</h1>
        <form id="loginForm" >
            <div class="input-group">
                <label for="email">邮箱</label>
                <input type="text" id="email" required>
            </div>
            <div id="password-login" class="input-group">
                <label for="password">密码</label>
                <input type="password" id="password">
            </div>
            <div id="code-login" class="input-group captcha-group" style="display:none;">
                <label for="captcha">邮箱验证码</label>
                <div class="captcha-container">
                    <input type="text" id="captcha" placeholder="输入邮箱验证码">
                    <button type="button" id="sendCodeBtn">发送验证码</button>
                </div>
            </div>
            <button type="submit" class="login-button">登录</button>
            <div class="switch-login-type">
                <span id="switchToCode">验证码登录</span>
                <span id="switchToPassword" style="display:none;">密码登录</span>
            </div>
            <div class="button-group">
                <button type="button" class="register-button" onclick="window.location.href='register.html'">注册</button>
                <button type="button" class="reset-button" onclick="window.location.href='foundpassword.html'">忘记密码</button>
            </div>

        </form>
    </div>
    <script src="../js/login.js"></script>
    <script src="../js/generateCaptcha.js"></script>
    <script>
        // 修改初始化代码
        function refreshCaptcha() {
            captchaCode = generateCaptcha(); // 确保生成新验证码
            document.getElementById('captchaImage').src = drawCaptcha();
        }
        
        // 初始化验证码
        refreshCaptcha();
    </script>
    <script src="//instant.page/5.2.0" type="module" integrity="sha384-jnZyxPjiipYXnSU0ygqeac2q7CVYMbh84q0uHVRRxEtvFPiQYbXWUorga2aqZJ0z"></script>
</body>
</html>
